package algotithm.interview.meituan.test5;

import java.io.*;

/**
 * @author zhouyanxiang
 * @Date 2021-03-2021/3/20-17:33
 */
public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] arr1 = reader.readLine().split(" ");
        int m0 = Integer.parseInt(arr1[0]);
        int w0 = Integer.parseInt(arr1[1]);
        int n = Integer.parseInt(reader.readLine());
        int t = n;
        int m = 0;
        int w = 0;
        int d = w0 / 100;
        String A = "A";
        String B = "B";
        String[][] s = new String[n][3];
        for (int i = 0; i < n; i++) {
            s[i] = reader.readLine().split(" ");
        }
        for (int i = 0; i < n; i++) {
            if ( A == String.valueOf(s[i][0])) {
                m = Integer.parseInt(s[i][1]);
                w = Integer.parseInt(s[i][2]);
                m0 += m;
                d = (m0 * w0 / 100 + m * w / 100) / m0;
                System.out.println( m0 + " " + String.format("%.5f",d));
            } else if ( B == String.valueOf(s[i][0])){
                m0 -= m;
                System.out.println( m0 + " " + String.format("%.5f",d));
            }
        }
        reader.close();
    }

}
